import { Form, Root, Textarea } from 'native-base';
import React from 'react';
import { ScrollView, Text, TextInput, View } from 'react-native';

export default function tpl(a: <T>(action: string, ...args: unknown[]) => ((...args: unknown[]) => void), s: (...class_names: string[]) => {}, d: (d: string) => string | unknown[] | number) {
	const dt = d('dt');
	const index = d('index') as number;
	const zymc = d('zymc') as string;
	const zynr = d('zynr') as string;
	// console.log(dt, index, zymc, zynr, '------dt--------');
	if (dt) {
		return (
			<Root>
				<View style={{ height: '100%', flexDirection: 'column', justifyContent: 'space-between' }}>
					<ScrollView>
						<View style={s('view1')}>
							<Text style={s('xx')}>基本信息</Text>
						</View>
						<View style={s('view2')}>
							<Text style={s('xs')}>所属学生：</Text>
							<Text style={s('xs')} onPress={a('a002', dt)}>{index === -1 ? '请选择' : dt[index]}</Text>
						</View>
						<View style={s('view2')}>
							<Text style={s('xs')}>作业名称：</Text>
							<TextInput style={s('input')} onChangeText={a('a004')} value={zymc}></TextInput>
						</View>
						<View style={{ padding: 10, borderWidth: 1, borderColor: '#dddddd' }}>
							<Form>
								<Textarea onChangeText={a('a005')} rowSpan={5} placeholder="请输入作业内容" value={zynr} />
							</Form>
						</View>
					</ScrollView>
					<Form>
						<View style={s('zd')}>
							<Text style={s('text1')} onPress={a('a006')}>发布</Text>
							<Text style={s('text2')} onPress={a('a003')}>取消</Text>
						</View>
					</Form>
				</View>
			</Root>
		);
	} else {
		return (<View></View>);
	}
}
